home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 11483 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: symbol type at runtime
  5. Date: Sun, 24 Mar 96 16:34:22 GMT
  6. Organization: none
  7. Message-ID: <827685262snz@genesis.demon.co.uk>
  8. References: <m0tzg3i-0001lOC@hammy.lonestar.org> <Pine.OSF.3.91.960322023421.12217A-100000@krtkg1.rug.ac.be>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <Pine.OSF.3.91.960322023421.12217A-100000@krtkg1.rug.ac.be>
  15.            colle@krtkg1.rug.ac.be "Christophe Colle" writes:
  16.  
  17. >> >I wonder if there is a way to find out the type of a variable at runtime, 
  18. >> >without using tricks like #define etc.
  19. >> 
  20. >> No.  If you want your function to know the size of an array you
  21. >> passed, you'll have to pass the size, somehow.
  22. >
  23. >I beleieve you when you say it is not in C, but there must be a way to 
  24. >find it, like debuggers do.
  25.  
  26. The only way that debuggers can find it is if you explicitly asked your
  27. compiler to add extra debugging information to the object file (e.g. using
  28. gcc -g). It is not part of nor accessible to normal code.
  29.  
  30.  Like when I fireup gdb, without the sources 
  31. >online it knows about the types... I'ld like to write something to debug 
  32. >more than gdb does. One of the things I wanna do is to check if i'm 
  33. >writing out of the bounds of an array. 
  34.  
  35. You need to find out about debugging data formats.
  36.  
  37. >Maybe I'll have to use the COFF-format to know more about variables, but 
  38. >since i have other work to do and i don't know where to look for books on 
  39. >the COFF-format I posted my question in this newsgroup. 
  40.  
  41. What you need is inherently system specific.
  42.  
  43. -- 
  44. -----------------------------------------
  45. Lawrence Kirby | fred@genesis.demon.co.uk
  46. Wilts, England | 70734.126@compuserve.com
  47. -----------------------------------------
  48.